package com.itheima.web.service.impl.sms;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.service.sms.ICouponHistoryService;
import com.itheima.vo.sms.CouponHistory;
import com.itheima.web.mapper.sms.CouponHistoryMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 优惠券使用、领取历史表 服务实现类
 */
@DubboService
public class CouponHistoryServiceImpl extends ServiceImpl<CouponHistoryMapper, CouponHistory> implements ICouponHistoryService {
@Autowired
    private ICouponHistoryService couponHistoryService;
    @Override
    public Page<CouponHistory> getPage(Long couponId, String orderSn, Integer useStatus, Integer pageNum, Integer pageSize) {
        Page<CouponHistory> pageInfo=new Page<>(pageNum,pageSize);
        LambdaQueryWrapper<CouponHistory> lqw=new LambdaQueryWrapper<>();
        lqw.eq(couponId!=null,CouponHistory::getCouponId,couponId);
        lqw.eq(orderSn!=null&&orderSn!="",CouponHistory::getOrderSn,orderSn);
        lqw.eq(useStatus!=null,CouponHistory::getUseStatus,useStatus);
        Page<CouponHistory> page = couponHistoryService.page(pageInfo, lqw);
        return pageInfo;
    }
}
